package com.wiloon.javax.tmp.spi;

import java.util.Iterator;
import java.util.ServiceLoader;

public class Demo {
    public static void main(String[] args) {
        ServiceLoader<XiheInterface> serviceLoader = ServiceLoader.load(XiheInterface.class);
        Iterator<XiheInterface> it = serviceLoader.iterator();

        System.out.println(it);
        System.out.println(it.hasNext());

        while (it != null && it.hasNext()) {
            XiheInterface demoService = it.next();
            System.out.println("class:" + demoService.getClass().getName());
            demoService.sayHi();
        }
    }
}
